export default {
    name: 'Onlinedevice',
    components:{},
    data() {
        return {
            currentTab: '/onlinedevicelist',
            showPage: '/onlinedevicelist',
            showPreview:'/onlinepreview',
            tabList: [
                {
                    action: '/onlinedevicelist',
                    name: '报表统计'
                },
                {
                    action: '/onlinemap',
                    name: '地图模式'
                },
                {
                    action: '/onlinepreview',
                    name: '视图模式'
                }
            ],
        }
    },
    computed: {

    },
    watch: {
        currentTab(newVal, oldVal) {
            this.$router.push({
                path: newVal,
            })
        },
        $route: {
            handler(val, oldVal) {
                if (val.path == '/onlinedevice') {
                    this.routeAgain();
                } else if(val.path == "/ninemode"){
                    this.currentTab = this.showPreview;
                } else if(val.path == "/onemode"){
                    this.currentTab = this.showPreview;
                } else if(val.path == "/fourmode"){
                    this.currentTab = this.showPreview;
                } else if(val.path == "/onlinepreview"){
                    this.currentTab = this.showPreview;
                } else if(val.path == '/onlinedevicelist'){
                    this.currentTab = this.showPage;
                }
            },
            //深度监听
            deep: true,
        },
    },
    created() {
        this.routeAgain();
    },
    mounted() {

    },
    methods: {
        routeAgain() {
            this.$router.push({
                path: this.showPage,
            });
        },
    },
}